﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DevExpress.Skins;
using DevExpress.LookAndFeel;
using DevExpress.UserSkins;
using DevExpress.XtraBars;
using DevExpress.XtraBars.Ribbon;
using DevExpress.XtraBars.Helpers;
using CNotebook;

namespace NotebookS2
{
    public partial class SETTING_DOCSERIES : RibbonForm
    {
        public SETTING_DOCSERIES()
        {
            InitializeComponent();
        }

        private DataTable SeriesInformation { get; set; }
        public string ConnectionString { get; set; }
        void BindDocumentSeries()
        {
            ObjectTypeManager oManager = new ObjectTypeManager();

            oManager.ConnectionString = this.ConnectionString;
            oManager.Open();
            this.SeriesInformation = oManager.GetObjectTypes();
            oManager.Close();

            gridControl1.DataSource = this.SeriesInformation;
            gridControl1.Refresh();
        }

        private void SETTING_DOCSERIES_Load(object sender, EventArgs e)
        {
            BindDocumentSeries();
            gridView1.ExpandAllGroups();
        }

        private void btnClose_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void btnApplyChanges_Click(object sender, EventArgs e)
        {
            ObjectTypeManager oManager = new ObjectTypeManager();

            oManager.ConnectionString = this.ConnectionString;
            oManager.Open();
            //this.SeriesInformation = oManager.GetObjectTypes();

            oManager.UpdateSeries(this.SeriesInformation);
            oManager.Close();
        }
    }
}
